package com.lyl.config;

import com.lyl.geetest.GeetestLib;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lylbell
 * @date 2021-06-28 16:07
 * geetest的自动配置类
 */
@Configuration
@EnableConfigurationProperties(GeetestProperties.class)
public class GeetestAutoConfiguration {

    @Autowired
    private GeetestProperties geetestProperties;

    public GeetestAutoConfiguration(GeetestProperties geetestProperties) {
        this.geetestProperties = geetestProperties;
    }

    @Bean
    public GeetestLib geetestLib() {
        GeetestLib geetestLib = new GeetestLib(geetestProperties.getGeetestId(),geetestProperties.getGeetestKey());
        return geetestLib;
    }
}
